package com.bayi.storage.base

import java.io.Serializable
import java.lang.Exception

/**
 * @author Administrator on 2024-05-31.
 *
 *
 * 站在顶峰 看世界
 * 落到谷底 思人生
 */
open class CanCopyModel : Serializable {
    fun <T> copy(): T? {
        return try {
            val t = javaClass.newInstance() as T
            for (f in javaClass.declaredFields) {
                f.isAccessible = true
                f[t] = f[this]
            }
            t
        } catch (ex: Exception) {
            ex.printStackTrace()
            null
        }
    }
}